<!DOCTYPE html>
<html>

<head>
  <title>登录-问答首页</title>
  <meta charset="utf-8">
  <meta name="Keywords " content="$SiteKeywords " />
  <meta name="Description " content="$SiteDescription " />
  <link rel="stylesheet " type="text/css " href="css/bootstrap.min.css" />
  <link rel="stylesheet " type="text/css " href="css/globle.css " />
  <link rel="stylesheet " type="text/css " href="css/popupInsert.css " />
  <link rel="stylesheet " type="text/css " href="css/style.css " />
  <script src='js/jquery-2.0.3.js'></script>
  <script src='js/jquery.cookie.js'></script>
  <script src='js/popupInsert.js'></script>
  <script src='js/index.js'></script>
  <script type="text/javascript">
    $(function() {
      $("form").submit(function(ev){
        ev.preventDefault();
        var data = $(this).serialize();
        $.post("/user/login",data,function(res,statusText){
          if(statusText == "success"){
            console.log(res);
            if(res.code == "success"){
              $.cookie("name",res.data.name);
              $.popup(res.content,function(){
                location.href = "/index.html"
              })
            }else{
              $.popup(res.content);
            }
          }
        })

      });
    });
  </script>
</head>

<body>
  <div class="h50"></div>
  <div id="nav">
    <nav class="nav">
      <!-- 用户下拉 -->
      <div class="user-info" style="display: none">
        <a href="javascript:;">个人资料</a>
        <a href="javascript:;">退出</a>
      </div>
      <div class="back"><span class="glyphicon glyphicon-chevron-left"></span></div>
      <div class="title">登录</div>
      <div class="user"><span class="glyphicon glyphicon-home fs18"></span>
      </div>
    </nav>
  </div>
  <main>
    <div class="ask-content">
      <form action="/login" method="post">
        <div class="form-group">
          <input type="text" name="name" class="form-control" required pattern="^[0-9a-zA-Z\u4e00-\u9fa5]{2,16}$" placeholder="请输入昵称">
        </div>
        <div class="form-group">
          <input type="password" name="password" class="form-control" required pattern="^.{6,16}$" placeholder="请输入密码">
        </div>
        <input type="submit" class="btn btn-success form-control" value="登陆" data-toggle="modal" data-target="#myModal">
      </form>
    </div>
  </main>
</body>

</html>
